home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compendium Deluxe 2
/
LSD and 17bit Compendium Deluxe - Volume II.iso
/
a
/
prog
/
misc
/
flexcat1_4.lha
/
flexcat
/
src
/
FlexCat_cat.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-24
|
5KB
|
143 lines
/****************************************************************
This file was created automatically by `FlexCat V1.4'
from "0.ct".
Do NOT edit by hand!
****************************************************************/
/****************************************************************
This file uses the auto initialization possibilities of
Dice and SAS/C, respectively.
Dice does this by using the keywords __autoinit and
__autoexit, SAS uses names beginning with _STI or
_STD, respectively.
Using this file you don't have *all* possibilities of
the locale.library. (No Locale or Language arguments are
supported when opening the catalog. However, these are
*very* rarely used, so this should be sufficient for most
applications.
****************************************************************/
/*
Include files and compiler specific stuff
*/
#include <clib/exec_protos.h>
#include <clib/locale_protos.h>
#if defined(__SASC) || defined(_DCC)
#include <pragmas/exec_pragmas.h>
#include <pragmas/locale_pragmas.h>
#else
#error "Don't know how to handle your compiler."
#endif
#ifdef __SASC
#define __autoinit
#define __autoexit
#endif
/*
Variables
*/
struct FC_Type
{ LONG ID;
STRPTR Str;
};
const struct FC_Type _msgMemoryError = { 0, "Out of memory!" };
const struct FC_Type _msgWarning = { 1, "%s, Line %d; warning: " };
const struct FC_Type _msgExpectedHex = { 2, "Expected hex character (one of [0-9a-4A-F])." };
const struct FC_Type _msgExpectedOctal = { 3, "Expected octal character (one of [0-7])." };
const struct FC_Type _msgNoCatalogDescription = { 4, "Cannot open catalog description %s." };
const struct FC_Type _msgNoLengthBytes = { 5, "LengthBytes > %d (sizeof long) not possible." };
const struct FC_Type _msgUnknownCDCommand = { 6, "Unknown catalog description command" };
const struct FC_Type _msgUnexpectedBlanks = { 7, "Unexpected blanks." };
const struct FC_Type _msgNoIdentifier = { 8, "Missing identifier." };
const struct FC_Type _msgNoLeadingBracket = { 9, "Missing '('." };
const struct FC_Type _msgDoubleID = { 10, "ID number used twice." };
const struct FC_Type _msgDoubleIdentifier = { 11, "Identifier redeclared." };
const struct FC_Type _msgNoMinLen = { 12, "Expected MinLen (character '/')." };
const struct FC_Type _msgNoMaxLen = { 13, "Expected MaxLen (character '/')." };
const struct FC_Type _msgNoTrailingBracket = { 14, "Expected ')'." };
const struct FC_Type _msgExtraCharacters = { 15, "Extra characters at the end of the line." };
const struct FC_Type _msgNoString = { 16, "Unexpected end of file (missing catalog string)." };
const struct FC_Type _msgShortString = { 17, "String too short." };
const struct FC_Type _msgLongString = { 18, "String too long." };
const struct FC_Type _msgNoCatalogTranslation = { 19, "Cannot open catalog translation file %s." };
const struct FC_Type _msgNoCTCommand = { 20, "Missing catalog translation command. (Expected second '#'.)" };
const struct FC_Type _msgUnknownCTCommand = { 21, "Unknown catalog translation command." };
const struct FC_Type _msgNoCTVersion = { 22, "Missing catalog translation version." };
const struct FC_Type _msgNoCTLanguage = { 23, "Missing catalog translation language." };
const struct FC_Type _msgNoCatalog = { 24, "Cannot open catalog file %s." };
const struct FC_Type _msgNoNewCTFile = { 25, "Cannot create catalog translation file %s." };
const struct FC_Type _msgUnknownIdentifier = { 26, "%s missing in catalog description." };
const struct FC_Type _msgNoSourceDescription = { 27, "Cannot open source description file %s." };
const struct FC_Type _msgNoSource = { 28, "Cannot open source file %s." };
const struct FC_Type _msgUnknownStringType = { 29, "Unknown string type." };
const struct FC_Type _msgNoTerminateBracket = { 30, "Unexpected end of line. (Missing ')')" };
const struct FC_Type _msgUsage = { 31, "Usage:\tFlexCat CDFILE/A,CTFILE,CATALOG/K,NEWCTFILE/K,SOURCES/M\n\n"\
" CDFILE:\tcatalog description file to scan.\n"\
" CTFILE:\tcatalog translation file to scan.\n"\
" CATALOG:\tcatalog file to create.\n"\
" NEWCTFILE:\tcatalog translation file to create.\n"\
" SOURCES:\tsources to create; must be something like sfile=sdfile,\n"\
"\t\twhere sfile is a sourcefile and sdfile is a source\n"\
"\t\tdescription file.\n" };
const struct FC_Type _msgNoCTArgument = { 32, "Creating a catalog needs a catalog translation file as argument." };
const struct FC_Type _msgNoBinChars = { 33, "Binary characters in stringtype None." };
static struct Catalog *FlexCat_Catalog = NULL;
extern struct ExecBase *SysBase;
STATIC struct Library *LocaleBase;
STATIC __autoinit VOID _STIOpenCatalog(VOID)
{
const STATIC struct TagItem tags[] =
{
{ OC_BuiltInLanguage, (ULONG) "english" },
{ OC_Version, 0 },
{ TAG_DONE, 0 }
};
if ((LocaleBase = OpenLibrary("locale.library", 38)))
{
FlexCat_Catalog = OpenCatalogA(NULL, (STRPTR) "FlexCat.catalog", tags);
}
}
STATIC __autoexit VOID _STDCloseCatalog(VOID)
{
if (LocaleBase)
{
CloseCatalog(FlexCat_Catalog);
FlexCat_Catalog = NULL;
CloseLibrary(LocaleBase);
}
}
STRPTR GetString(struct FC_Type *fcstr)
{
STRPTR defaultstr;
LONG strnum;
strnum = fcstr->ID;
defaultstr = fcstr->Str;
return(FlexCat_Catalog ? GetCatalogStr(FlexCat_Catalog, strnum, defaultstr) :
defaultstr);
}